package io.renren.modules.usian.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.usian.entity.ClasssEntity;
import io.renren.modules.usian.service.ClasssService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author Lfz
 * @email 2534635077@qq.com
 * @date 2022-10-26 18:31:10
 */
@RestController
@RequestMapping("usian/classs")
public class ClasssController {
    @Autowired
    private ClasssService classsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
   // @RequiresPermissions("usian:classs:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = classsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
   // @RequiresPermissions("usian:classs:info")
    public R info(@PathVariable("id") Integer id){
		ClasssEntity classs = classsService.getById(id);

        return R.ok().put("classs", classs);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
  //  @RequiresPermissions("usian:classs:save")
    public R save(@RequestBody ClasssEntity classs){
		classsService.save(classs);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
   // @RequiresPermissions("usian:classs:update")
    public R update(@RequestBody ClasssEntity classs){
		classsService.updateById(classs);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
   // @RequiresPermissions("usian:classs:delete")
    public R delete(@RequestBody Integer[] ids){
		classsService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
